package com.example.demo;

import com.example.demo.model.Emp;
import org.apache.ibatis.annotations.*;
import org.joda.money.Money;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Mapper
public interface EmpMapper {

    @Insert("insert into t_emp(name,job,salary) values(#{name},#{job},#{salary})")
    @Options(useGeneratedKeys = true, keyColumn = "id", keyProperty = "id")
    void save(Emp emp);
    @Update("update t_emp set name=#{name} where id=#{id}")
    void editEmp(String name,Long id);
    @Select("select * from t_emp where name like '${value}%'")
    List<Emp> findEmpsByNameLike(String name);
    @Select("select * from t_emp")
    List<Emp> findEmps();
    @Select("select * from t_emp where name=#{name} and job=#{job} and salary=#{salary}")
    List<Emp> findEmployee(@Param("name")String name, @Param("job")String job, @Param("salary")Money salary);

}
